<?php
	//session_destroy();
	session_start();
	$_SESSION['value']="none";
	class EditResidentManager{
	
		public function validate($str,$param1){
		
			if(is_numeric($param1)&&($str!=null||$str!="")&&(!is_numeric($param1))){
					return true;
				}else{
					return false;
				}
			}


		public function editStudentForm1($str,$param1){
		
			$conn = oci_connect("naiad", "1234", "localhost/XE");
			if((strcmp($str,"snum"))==0){
				$s = oci_parse($conn, "select STUDENTNO,NAMEFIRST,NAMELAST,NAMEMIDDLE,BIRTHDATE,GENDER,CIVILSTATUS,LASTSCHOOL,LASTSCHOOLTYPE,RELIGION,CLASSIFICATION,STFAPBRACKET,SCHOLARSHIPS,ALLOWANCE,CELLNO,EMAIL,HOBBIES,HONORS,TALENTS,AILMENTS,MEDICATIONS,HOMEADDRESS,COURSE,COLLEGE FROM STUDENT where STUDENTNO like '".$param1."'");
			}				
			
			oci_execute($s);
			$nrows = oci_fetch_all($s, $results);
			if($nrows!=0){
				$i = 0;
				$_SESSION['studentno']=$results['STUDENTNO'][$i];
				$_SESSION['namelast']=$results['NAMELAST'][$i];
				$_SESSION['namefirst']=$results['NAMEFIRST'][$i];
				$_SESSION['namemiddle']=$results['NAMEMIDDLE'][$i];
				$_SESSION['course']=$results['COURSE'][$i];
				$_SESSION['birthdate']=$results['BIRTHDATE'][$i];
				$_SESSION['homeaddress']=$results['HOMEADDRESS'][$i];
				$_SESSION['gender']=$results['GENDER'][$i];
				$_SESSION['civilstatus']=$results['CIVILSTATUS'][$i];
				$_SESSION['lastschool']=$results['LASTSCHOOL'][$i];
				$_SESSION['lastschooltype']=$results['LASTSCHOOLTYPE'][$i];
				$_SESSION['religion']=$results['RELIGION'][$i];
				$_SESSION['classification']=$results['CLASSIFICATION'][$i];
				$_SESSION['stfapbracket']=$results['STFAPBRACKET'][$i];
				$_SESSION['scholarships']=$results['SCHOLARSHIPS'][$i];
				$_SESSION['allowance']=$results['ALLOWANCE'][$i];
				$_SESSION['cellno']=$results['CELLNO'][$i];
				$_SESSION['email']=$results['EMAIL'][$i];
				$_SESSION['hobbies']=$results['HOBBIES'][$i];
				$_SESSION['honors']=$results['HONORS'][$i];
				$_SESSION['talents']=$results['TALENTS'][$i];
				$_SESSION['ailments']=$results['AILMENTS'][$i];
				$_SESSION['medications']=$results['MEDICATIONS'][$i];
				$_SESSION['college']=$results['COLLEGE'][$i];
				//
				//$_SESSION['fathername']=$results['FATHERNAME'][$i]
			
				return 1;
			}else{
				return 0;
			
			}
		}//end of editStudentInfo function
	
		
		public function editStudentForm2($str,$param1){
		
			$conn = oci_connect("naiad", "1234", "localhost/XE");	
			if((strcmp($str,"snum"))==0){
				$s = oci_parse($conn, "select STUDENTNO,FATHERNAME,FJOB,FOFFICE,FINCOME,FLIFE,FEMPLOYER,FTELNUM,MOTHERNAME,MJOB,MOFFICE,MINCOME,MLIFE,MEMPLOYER,MTELNUM FROM PARENTS where STUDENTNO like '".$param1."'");
			}			
			
			oci_execute($s);
			$nrows = oci_fetch_all($s, $results);
			$i = 0;
			$_SESSION['studentno']=$results['STUDENTNO'][$i];
			$_SESSION['fathername']=$results['FATHERNAME'][$i];
			$_SESSION['fjob']=$results['FJOB'][$i];
			$_SESSION['foffice']=$results['FOFFICE'][$i];
			$_SESSION['fincome']=$results['FINCOME'][$i];
			$_SESSION['flife']=$results['FLIFE'][$i];
			$_SESSION['femployer']=$results['FEMPLOYER'][$i];
			$_SESSION['ftelnum']=$results['FTELNUM'][$i];
			$_SESSION['mothername']=$results['MOTHERNAME'][$i];
			$_SESSION['mjob']=$results['MJOB'][$i];
			$_SESSION['moffice']=$results['MOFFICE'][$i];
			$_SESSION['mincome']=$results['MINCOME'][$i];
			$_SESSION['mlife']=$results['MLIFE'][$i];
			$_SESSION['memployer']=$results['MEMPLOYER'][$i];
			$_SESSION['mtelnum']=$results['MTELNUM'][$i];
		
		return 1;	
		}//end of editStudentParent function
		

		public function editStudentForm3($str,$param1){
		
			$conn = oci_connect("naiad", "1234", "localhost/XE");
				
			if((strcmp($str,"snum"))==0){
				$s = oci_parse($conn, "select STUDENTNO,REGION,PARENTMARRIAGESTATUS,NUMBROTHERS,NUMSISTERS,ORDERBIRTH FROM FAMILY where STUDENTNO like '".$param1."'");
			}
			oci_execute($s);
			$nrows = oci_fetch_all($s, $results);
			$i = 0;
			$_SESSION['studentno']=$results['STUDENTNO'][$i];
			$_SESSION['region']=$results['REGION'][$i];
			$_SESSION['marriagestat']=$results['PARENTMARRIAGESTATUS'][$i];
			$_SESSION['brothers']=$results['NUMBROTHERS'][$i];
			$_SESSION['sisters']=$results['NUMSISTERS'][$i];
			$_SESSION['order']=$results['ORDERBIRTH'][$i];
			
			
		return 1;	
		}//end of editStudentInfo function
		
		public function editStudentForm4($str,$param1){
		
			$conn = oci_connect("naiad", "1234", "localhost/XE");
				
			if((strcmp($str,"snum"))==0){
				$s = oci_parse($conn, "select STUDENTNO,NAME,ADDRESS,TELNO FROM GUARDIAN where STUDENTNO like '".$param1."'");
			}
			oci_execute($s);
			$nrows = oci_fetch_all($s, $results);
			$i = 0;
			$_SESSION['studentno']=$results['STUDENTNO'][$i];
			$_SESSION['name']=$results['NAME'][$i];
			$_SESSION['address']=$results['ADDRESS'][$i];
			$_SESSION['telno']=$results['TELNO'][$i];
			
			
			
		return 1;	
		}//end of editStudentInfo function
				
		
		
	}//end of EditStudentManager class

?>